// 变为树节点
const toTree = (data, rootValue) => {
    const result = []
    data.map(item => {
        if (item.pid == rootValue) {
            result.push(item)
            const child = toTree(data, item.id)
            child ? item.child = child : ''
        }
    })
    return result
}
export default function (data, rootValue) {
    return toTree(data, rootValue)
}